<template>
  <div class="hello">
    <h1>{{ msg }}</h1>
    <h2>Essential Links</h2>
    <ul>
      <li>
        <a
          href="https://vuejs.org"
          target="_blank"
        >
          Core Docs
        </a>
      </li>
      <li>
        <a
          href="https://forum.vuejs.org"
          target="_blank"
        >
          Forum
        </a>
      </li>
      <li>
        <a
          href="https://chat.vuejs.org"
          target="_blank"
        >
          Community Chat
        </a>
      </li>
      <li>
        <a
          href="https://twitter.com/vuejs"
          target="_blank"
        >
          Twitter
        </a>
      </li>
      <br>
      <li>
        <a
          href="http://vuejs-templates.github.io/webpack/"
          target="_blank"
        >
          Docs for This Template
        </a>
      </li>
    </ul>
    <h2>Ecosystem</h2>
    <ul>
      <li>
        <a
          href="http://router.vuejs.org/"
          target="_blank"
        >
          vue-router
        </a>
      </li>
      <li>
        <a
          href="http://vuex.vuejs.org/"
          target="_blank"
        >
          vuex
        </a>
      </li>
      <li>
        <a
          href="http://vue-loader.vuejs.org/"
          target="_blank"
        >
          vue-loader
        </a>
      </li>
      <li>
        <a
          href="https://github.com/vuejs/awesome-vue"
          target="_blank"
        >
          awesome-vue
        </a>
      </li>
    </ul>
  </div>
</template>

<script>
import mobileshield from '@uep/js-smAlgo';
export default {
  name: 'HelloWorld',
  data () {
    return {
      msg: 'Welcome to Your Vue.js App'
    }
  },
  mounted() { // 组件初始化
    //SM2加密密码
    var plain = 'abc';
    var publicKey = '046A5E2B95AE2C7D868979A4970F732ADC8A31A71E694859FD170129B2662AF56E5FF246A8734E3AD59DF6C1BBCB2191A17AB8281730B113267CD03EF69EEB97B5';
    var inPlain = mobileshield.parseUtf8StringToHex(plain);//将字符串转16进制
    console.log("inPlain：" + inPlain)
    var plainText = mobileshield.hexToArray(inPlain);//16进制转换数组
    console.log("plainText：" + plainText)
    //加密
    var cipher = mobileshield.SSM_ExtSM2DoEncrypt_Array(publicKey, plainText);
    console.log("cipher：" + cipher)
    var cipherText = mobileshield.arrayToHex(cipher)
    console.log("cipherText1：" + cipherText)

  }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
h1, h2 {
  font-weight: normal;
}
ul {
  list-style-type: none;
  padding: 0;
}
li {
  display: inline-block;
  margin: 0 10px;
}
a {
  color: #42b983;
}
</style>
